package com.ctshk.rpc.iotc.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ctshk.rpc.iotc.entity.OperatePromotionProduct;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 推广码适用产品 Mapper 接口
 * </p>
 *
 * @author 谢诗宏
 * @since 2021-01-22
 */
public interface OperatePromotionProductMapper extends BaseMapper<OperatePromotionProduct> {



    @Update("UPDATE t_operate_promotion_product SET is_deleted = 1 " +
            "WHERE relation_id = #{relation_id} AND code_id = #{code_id}")
    void updateByCodeIdAndRelationId(@Param("code_id") Long Id, @Param("relation_id") Long relationId);

    @Select({"<script>",
            "SELECT id FROM t_operate_promotion_product " ,
                    "WHERE code_id = #{code_id} AND is_deleted = 0",
            "</script>"})
    List<Long> selectTripScheduleIds(@Param("coed_id") Long id);
}
